;(function(){
  'use strict';
  angular.module('services.faultLocation.failureLocation',[])
    .factory('FailureFoundServer',failureFoundServer)
    .factory('FailureModelServer',failureModelServer)
    .factory('FailureNoticeServer',failureNoticeServer);

  function failureFoundServer(Restangular){
    return{
      failureFound:failureFound,
      failureRealtime:failureRealtime,
      failureOrientate:failureOrientate,
      businessUsability:businessUsability,
      busSucceedByIp:busSucceedByIp,
      phasePosition:phasePosition
    };
    function failureRealtime(param,callback){
      return Restangular.all('sas/faultLocation/findFault/realTime').post(param).then(callback);
    }

    function failureFound(param,callback){
      return Restangular.all('sas/faultLocation/findFault/query').post(param).then(callback);
    }
    
    function businessUsability(param,callback){
      return Restangular.all('sas/faultLocation/findFault/usability').post(param).then(callback);
    }

    function failureOrientate(param,callback){
      return Restangular.all('sas/faultLocation/positionFault/query').post(param).then(callback);
    }

    function busSucceedByIp(param,callback){
      return Restangular.all('sas/faultLocation/positionFault/busSucceedByIp').post(param).then(callback);
    }

    function phasePosition(param,callback){
      return Restangular.all('sas/faultLocation/positionFault/phasePosition').post(param).then(callback);
    }
  }
  failureFoundServer.$inject = ['Restangular'];
  function failureModelServer(Restangular){
    return {
      failureModelQuery:failureModelQuery,
      singletonModel:singletonModel,
      buildAddtion:buildAddtion,
      modifyBuild:modifyBuild,
      deleteBuild:deleteBuild
    };

    function failureModelQuery(param,callback){
      return Restangular.all('sas/faultLocation/model/query').post(param).then(callback);
    }

    function singletonModel(param,callback){
      return Restangular.all('sas/faultLocation/model/singletonShow').post(param).then(callback);
    }

    function buildAddtion(param,callback){
      return Restangular.all('sas/faultLocation/model/buildAddtion').post(param).then(callback);
    }

    function modifyBuild(param,callback){
      return Restangular.all('sas/faultLocation/model/modifyBuild').post(param).then(callback);
    }

    function deleteBuild(param,callback){
      return Restangular.all('sas/faultLocation/model/deleteBuild').post(param).then(callback);
    }
  }
  failureModelServer.$inject = ['Restangular'];

  function failureNoticeServer(Restangular){
    return{
      noticeQuery:noticeQuery,
      updateNotice:updateNotice
    };

    function noticeQuery(){
      return Restangular.one('sas/faultLocation/notice/query').get();
    }

    function updateNotice(param,callback){
      return Restangular.all('sas/faultLocation/notice/add').post(param).then(callback);
    }
  }
  failureNoticeServer.$inject = ['Restangular'];
})();